<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <ul>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>
    <script>
        var ul = document.querySelector('.box').querySelector('ul');
        console.log(ul.children);
        console.log(ul.childNodes);
        console.log(getChildNodes(ul));
        

        // 去除文本等节点，只保留元素节点
        function getChildNodes(node) {
            if (node.childNodes.length == 0) {
                return;
            }
            var childNodes = new Array();
            for(var i = 0; i < node.childNodes.length; i++){
                if (node.childNodes[i].nodeType == 1) {
                    //代表元素节点
                    childNodes.push(node.childNodes[i])
                }
            }
            if (childNodes.length == 0) {
                return;
            }

            return childNodes;
        }
    </script>
</body>
</html>